package org.example.petitionplatformsystem.service.Impl;

import org.example.petitionplatformsystem.dao.ProcessResultsRepository;
import org.example.petitionplatformsystem.dao.model.ProcessResults;
import org.example.petitionplatformsystem.service.ProcessResultsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProcessResultsServiceImpl implements ProcessResultsService {
    @Autowired
    private ProcessResultsRepository processResultsRepository;

    @Override
    public void addProcessResult(ProcessResults processResult) {
        processResultsRepository.save(processResult);
    }

    @Override
    public void updateProcessResult(ProcessResults processResult) {
        processResultsRepository.save(processResult);
    }

    @Override
    public void deleteProcessResult(ProcessResults processResult) {
        processResultsRepository.delete(processResult);
    }

    @Override
    public ProcessResults getProcessResultById(long id) {
        return processResultsRepository.findById(id).orElse(null);
    }

    @Override
    public List<ProcessResults> getAllProcessResults() {
        return processResultsRepository.findAll();
    }
}
